<?php 
//Setup the is main array for segment project
$segmentProjectIsMainArr = array('0'=>Yii::t('project','Not Main Segment Project'), '1'=>Yii::t('project','Main Segment Project'));
//Identify the Unit Project Type based on its belong project type
switch ($unitProject->type)
{
	case 'Dike-Levees-Body':
		$segmentProjectTypeArr = array(
			'Dike-Levees-Body-Foundation-Handle' => Yii::t('project','Levees-Foundation-Handle'),
			'Dike-Levees-Body-Foundation-Handle' => Yii::t('project','Levees-Foundation-Impervious'),
			'Dike-Levees-Body-Body-Impervious' => Yii::t('project','Levees-Body-Impervious'),
			'Dike-Levees-Body-Body-Filling' => Yii::t('project','Levees-Body-Filling'),
			'Dike-Levees-TKGJ' => Yii::t('project','Levees-TKGJ'),
			'Dike-Levees-YJPT' => Yii::t('project','Levees-YJPT'),
			'Dike-Levees-DSFH' => Yii::t('project','Levees-DSFH'),
			'Dike-Levees-DJFH' => Yii::t('project','Levees-DJFH'),
			'Dike-Levees-XXCDJZW' => Yii::t('project','Levees-XXCDJZW'),
		);
		break;
	case 'Dike-Embankment':
		$segmentProjectTypeArr = array(
			'Dike-Embankment-HJGC' => Yii::t('project','Dike-Embankment-HJGC'),
			'Dike-Embankment-HPGC' => Yii::t('project','Dike-Embankment-HPGC'),
		);
		break;
	case 'Dike-Culverts':
		$segmentProjectTypeArr = array(
			'Dike-Culverts-DDYJCGC' => Yii::t('project','Dike-Culverts-DDYJCGC'),
			'Dike-Culverts-JKD' => Yii::t('project','Dike-Culverts-JKD'),
			'Dike-Culverts-DS' => Yii::t('project','Dike-Culverts-DS'),
			'Dike-Culverts-CKD' => Yii::t('project','Dike-Culverts-CKD'),
		);
		break;
	case 'Dike-Sluice':
		$segmentProjectTypeArr = array(
			'Dike-Sluice-SYLJD' => Yii::t('project','Dike-Sluice-SYLJD'),
			'Dike-Sluice-DJYJC' => Yii::t('project','Dike-Sluice-DJYJC'),
			'Dike-Sluice-ZS' => Yii::t('project','Dike-Sluice-ZS'),
			'Dike-Sluice-JTQ' => Yii::t('project','Dike-Sluice-JTQ'),
			'Dike-Sluice-XNFCD' => Yii::t('project','Dike-Sluice-XNFCD'),
			'Dike-Sluice-XYLJD' => Yii::t('project','Dike-Sluice-XYLJD'),
			'Dike-Sluice-JSJGJQBJAZ' => Yii::t('project','Dike-Sluice-JSJGJQBJAZ'),
		);
		break;
	case 'Dike-Road-Bridge':
		$segmentProjectTypeArr = array(
		'Dike-Road-Bridge-JCJXBGZ' => Yii::t('project','Dike-Road-Bridge-JCJXBGZ'),
		'Dike-Road-Bridge-SBGZYZHAZ' => Yii::t('project','Dike-Road-Bridge-SBGZYZHAZ'),
		'Dike-Road-Bridge-SBGZXCJZ' => Yii::t('project','Dike-Road-Bridge-SBGZXCJZ'),
		'Dike-Road-Bridge-ZQF' => Yii::t('project','Dike-Road-Bridge-ZQF'),
		'Dike-Road-Bridge-FHGC' => Yii::t('project','Dike-Road-Bridge-FHGC'),
		'Dike-Road-Bridge-YDGC' => Yii::t('project','Dike-Road-Bridge-YDGC'),
		);
		break;
	case 'Dike-Road':
		$segmentProjectTypeArr = array(
		'Dike-Road-LJTSFGC' => Yii::t('project','Dike-Road-LJTSFGC'),
		'Dike-Road-PSGC' => Yii::t('project','Dike-Road-PSGC'),
		'Dike-Road-XQTQ' => Yii::t('project','Dike-Road-XQTQ'),
		'Dike-Road-HDTD' => Yii::t('project','Dike-Road-HDTD'),
		'Dike-Road-QZFHGC' => Yii::t('project','Dike-Road-QZFHGC'),
		'Dike-Road-DTQ' => Yii::t('project','Dike-Road-DTQ'),
		'Dike-Road-LMGC' => Yii::t('project','Dike-Road-LMGC'),
		);
		break;
	case 'Dike-Management Facilities':
		$segmentProjectTypeArr = array(
		'Dike-MF-GCSS' => Yii::t('project','Dike-MF-GCSS'),
		'Dike-MF-SCSH' => Yii::t('project','Dike-MF-SCSH'),
		'Dike-MF-JTGC' => Yii::t('project','Dike-MF-JTGC'),
		'Dike-MF-TXGC' => Yii::t('project','Dike-MF-TXGC'),
		);
		break;
	case 'Diversion-Open-Channel':
	case 'Diversion-Closed-Channel':
		$segmentProjectTypeArr = array(
		'Diversion-Channel-QJKWGC' => Yii::t('project','Diversion-Channel-QJKWGC'),
		'Diversion-Channel-QJTZGC' => Yii::t('project','Diversion-Channel-QJTZGC'),
		'Diversion-Channel-QDCQGC' => Yii::t('project','Diversion-Channel-QDCQGC'),
		'Diversion-Channel-QDGC' => Yii::t('project','Diversion-Channel-QDGC'),
		'Diversion-Channel-GBPCL' => Yii::t('project','Diversion-Channel-GBPCL'),
		'Diversion-Channel-XXQXJZW' => Yii::t('project','Diversion-Channel-XXQXJZW'),
		);
		break;
	case 'Diversion-Sluice':
		$segmentProjectTypeArr = array(
		'Diversion-Sluice-SYYHD' => Yii::t('project','Diversion-Sluice-SYYHD'),
		'Diversion-Sluice-SYLJD' => Yii::t('project','Diversion-Sluice-SYLJD'),
		'Diversion-Sluice-ZJKWCL' => Yii::t('project','Diversion-Sluice-ZJKWCL'),
		'Diversion-Sluice-DJFSPS' => Yii::t('project','Diversion-Sluice-DJFSPS'),
		'Diversion-Sluice-ZSD' => Yii::t('project','Diversion-Sluice-ZSD'),
		'Diversion-Sluice-XNFCD' => Yii::t('project','Diversion-Sluice-XNFCD'),
		'Diversion-Sluice-XYLJD' => Yii::t('project','Diversion-Sluice-XYLJD'),
		'Diversion-Sluice-XYYHD' => Yii::t('project','Diversion-Sluice-XYYHD'),
		'Diversion-Sluice-QLGC' => Yii::t('project','Diversion-Sluice-QLGC'),
		'Diversion-Sluice-JSJGQBJ' => Yii::t('project','Diversion-Sluice-JSJGQBJ'),
		'Diversion-Sluice-GLF' => Yii::t('project','Diversion-Sluice-GLF'),
		);
		break;
	case 'Diversion-Aqueduct':
		$segmentProjectTypeArr = array(
		'Diversion-Aqueduct-JCGC' => Yii::t('project','Diversion-Aqueduct-JCGC'),
		'Diversion-Aqueduct-JCKD' => Yii::t('project','Diversion-Aqueduct-JCKD'),
		'Diversion-Aqueduct-ZCJG' => Yii::t('project','Diversion-Aqueduct-ZCJG'),
		'Diversion-Aqueduct-CS' => Yii::t('project','Diversion-Aqueduct-CS'),
		);
		break;
	case 'Diversion-Tunnel':
		$segmentProjectTypeArr = array(
		'Diversion-Tunnel-JKD' => Yii::t('project','Diversion-Tunnel-JKD'),
		'Diversion-Tunnel-DSD' => Yii::t('project','Diversion-Tunnel-DSD'),
		'Diversion-Tunnel-DSKW' => Yii::t('project','Diversion-Tunnel-DSKW'),
		'Diversion-Tunnel-DSCQ' => Yii::t('project','Diversion-Tunnel-DSCQ'),
		'Diversion-Tunnel-SDGJGJ' => Yii::t('project','Diversion-Tunnel-SDGJGJ'),
		'Diversion-Tunnel-SDHTGJ' => Yii::t('project','Diversion-Tunnel-SDHTGJ'),
		'Diversion-Tunnel-DTD' => Yii::t('project','Diversion-Tunnel-DTD'),
		'Diversion-Tunnel-CKD' => Yii::t('project','Diversion-Tunnel-CKD'),
		);
		break;
	case 'Diversion-Inverted-Siphon-Project':
		$segmentProjectTypeArr = array(
		'Diversion-Inverted-Siphon-Project-JKD' => Yii::t('project','Diversion-Inverted-Siphon-Project-JKD'),
		'Diversion-Inverted-Siphon-Project-GDD' => Yii::t('project','Diversion-Inverted-Siphon-Project-GDD'),
		'Diversion-Inverted-Siphon-Project-CKD' => Yii::t('project','Diversion-Inverted-Siphon-Project-CKD'),
		'Diversion-Inverted-Siphon-Project-JSJGJQBJAZ' => Yii::t('project','Diversion-Inverted-Siphon-Project-JSJGJQBJAZ'),
		);
		break;
	case 'Diversion-Culverts':
		$segmentProjectTypeArr = array(
		'Diversion-Culverts-JCYDJGC' => Yii::t('project','Diversion-Culverts-JCYDJGC'),
		'Diversion-Culverts-JKD' => Yii::t('project','Diversion-Culverts-JKD'),
		'Diversion-Culverts-DS' => Yii::t('project','Diversion-Culverts-DS'),
		'Diversion-Culverts-CKD' => Yii::t('project','Diversion-Culverts-CKD'),
		);
		break;
	case 'Diversion-Pumping-Station':
		$segmentProjectTypeArr = array(
		'Diversion-Pumping-Station-YQ' => Yii::t('project','Diversion-Pumping-Station-YQ'),
		'Diversion-Pumping-Station-QCJJSC' => Yii::t('project','Diversion-Pumping-Station-QCJJSC'),
		'Diversion-Pumping-Station-DJYJCCL' => Yii::t('project','Diversion-Pumping-Station-DJYJCCL'),
		'Diversion-Pumping-Station-ZJD' => Yii::t('project','Diversion-Pumping-Station-ZJD'),
		'Diversion-Pumping-Station-JXJ' => Yii::t('project','Diversion-Pumping-Station-JXJ'),
		'Diversion-Pumping-Station-PDJ' => Yii::t('project','Diversion-Pumping-Station-PDJ'),
		'Diversion-Pumping-Station-BFFJGC' => Yii::t('project','Diversion-Pumping-Station-BFFJGC'),
		'Diversion-Pumping-Station-ZJBSBAZ' => Yii::t('project','Diversion-Pumping-Station-ZJBSBAZ'),
		'Diversion-Pumping-Station-FZSBAZ' => Yii::t('project','Diversion-Pumping-Station-FZSBAZ'),
		'Diversion-Pumping-Station-JSJGJQBJAZ' => Yii::t('project','Diversion-Pumping-Station-JSJGJQBJAZ'),
		'Diversion-Pumping-Station-SSGDGC' => Yii::t('project','Diversion-Pumping-Station-SSGDGC'),
		'Diversion-Pumping-Station-BDZ' => Yii::t('project','Diversion-Pumping-Station-BDZ'),
		'Diversion-Pumping-Station-CSC' => Yii::t('project','Diversion-Pumping-Station-CSC'),
		'Diversion-Pumping-Station-GCSS' => Yii::t('project','Diversion-Pumping-Station-GCSS'),
		'Diversion-Pumping-Station-QL' => Yii::t('project','Diversion-Pumping-Station-QL'),
		);
		break;
	case 'Diversion-Road-Bridge':
		$segmentProjectTypeArr = array(
		'Diversion-Road-Bridge-JCJXBGZ' => Yii::t('project','Diversion-Road-Bridge-JCJXBGZ'),
		'Diversion-Road-Bridge-SBGZYZHAZ' => Yii::t('project','Diversion-Road-Bridge-SBGZYZHAZ'),
		'Diversion-Road-Bridge-SBGZXCJZ' => Yii::t('project','Diversion-Road-Bridge-SBGZXCJZ'),
		'Diversion-Road-Bridge-ZQF' => Yii::t('project','Diversion-Road-Bridge-ZQF'),
		'Diversion-Road-Bridge-FHGC' => Yii::t('project','Diversion-Road-Bridge-FHGC'),
		'Diversion-Road-Bridge-YDGC' => Yii::t('project','Diversion-Road-Bridge-YDGC'),
		);
		break;
	case 'Diversion-Lock':
		$segmentProjectTypeArr = array(
		'Diversion-Lock-SYYHDD' => Yii::t('project','Diversion-Lock-SYYHDD'),
		'Diversion-Lock-SYLJD' => Yii::t('project','Diversion-Lock-SYLJD'),
		'Diversion-Lock-SZSD' => Yii::t('project','Diversion-Lock-SZSD'),
		'Diversion-Lock-ZSD' => Yii::t('project','Diversion-Lock-ZSD'),
		'Diversion-Lock-XZSD' => Yii::t('project','Diversion-Lock-XZSD'),
		'Diversion-Lock-XYLJD' => Yii::t('project','Diversion-Lock-XYLJD'),
		'Diversion-Lock-DJJCFSPS' => Yii::t('project','Diversion-Lock-DJJCFSPS'),
		'Diversion-Lock-XYYHDD' => Yii::t('project','Diversion-Lock-XYYHDD'),
		'Diversion-Lock-QLGC' => Yii::t('project','Diversion-Lock-QLGC'),
		'Diversion-Lock-ZMQB' => Yii::t('project','Diversion-Lock-ZMQB'),
		'Diversion-Lock-DQSB' => Yii::t('project','Diversion-Lock-DQSB'),
		'Diversion-Lock-FSSS' => Yii::t('project','Diversion-Lock-FSSS'),
		);
		break;
	case 'Diversion-Management Facilities':
		$segmentProjectTypeArr = array(
		'Diversion-MF-GCSS' => Yii::t('project','Diversion-MF-GCSS'),
		'Diversion-MF-SCSH' => Yii::t('project','Diversion-MF-SCSH'),
		'Diversion-MF-JTGC' => Yii::t('project','Diversion-MF-JTGC'),
		'Diversion-MF-TXGC' => Yii::t('project','Diversion-MF-TXGC'),
		);
		break;
	default:
		$segmentProjectTypeArr = array(
			'Undefined' => Yii::t('common','Undefined'),
		);;
}

?>

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'segment-project-form',
	'enableAjaxValidation'=>false,
)); ?>

	<?php echo $form->errorSummary($model); ?>

	<?php echo $form->textFieldRow($model,'name',array('class'=>'span5','maxlength'=>48)); ?>
	
	<?php echo $form->labelEx($model,'is_main');?>
	<?php echo $form->dropDownList($model, 'is_main', $segmentProjectIsMainArr); ?>
	
	<?php echo $form->labelEx($model,'type');?>
	<?php echo $form->dropDownList($model, 'type', $segmentProjectTypeArr); ?>
	
	<?php echo $form->textFieldRow($model,'plan_invest',array('class'=>'span2','maxlength'=>15)); ?>

	<?php echo $form->textAreaRow($model,'description',array('class'=>'span5','maxlength'=>255)); ?>

	<?php 
	echo $form->labelEx($model,'pre_start_at');
	$this->widget('zii.widgets.jui.CJuiDatePicker',array(
			'name'=>'SegmentProject[pre_start_at]',
			'language' => 'zh-CN',
			'value' => substr($model->pre_start_at, 0, 10),
			// additional javascript options for the date picker plugin
			'options'=>array(
					'changeMonth' => 'true',
					'changeYear' => 'true',
					'showButtonPanel' => 'true',
			),
			'htmlOptions'=>array(
					'class'=>'span2'
			),
	));
	?>
	
	<?php 
	echo $form->labelEx($model,'pre_end_at');
	$this->widget('zii.widgets.jui.CJuiDatePicker',array(
			'name'=>'SegmentProject[pre_end_at]',
			'language' => 'zh-CN',
			'value' => substr($model->pre_end_at, 0, 10),
			// additional javascript options for the date picker plugin
			'options'=>array(
					'changeMonth' => 'true',
					'changeYear' => 'true',
					'showButtonPanel' => 'true',
					//	'showAnim'=>'fold',
			),
			'htmlOptions'=>array(
					'class'=>'span2'
			),
	));
	?>
	
	<div class="form-actions">
		<?php 
		if($model->isNewRecord)	$cancelUrl = array('unitProject/sub', 'id'=>$unitProject->id);
		else $cancelUrl = array('segmentProject/status', 'id'=>$model->id);
		
		$this->widget('bootstrap.widgets.TbButton', array(
				'buttonType'=>'link',
				'type'=>'link',
				'url'=>$cancelUrl,
				'label'=>Yii::t('common','Cancel'),
			)); 
		?>
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? Yii::t('common','Create') : Yii::t('common','Save and Next'),
		)); ?>
	</div>

<?php $this->endWidget(); ?>